<?php

	class cct_articles extends ctl_articles
	{
		function addArticle($node_id)
		{
			if($_POST['ifpub']) $_POST['ifpub'] = 1;
			else $_POST['ifpub'] = 0;
			$oArticle = $this->system->loadModel('content/article');
			if(!$oArticle->addArticle($_POST,$msg))
			{
				$this->splash('failed','index.php?ctl=content/articles&act=index&p[0]='.$node_id,$msg);
			}
			$this->splash('success','index.php?ctl=content/articles&act=index&p[0]='.$node_id,__('文章添加成功'));
		}

		function detail($nConId)
		{
			$oArticle = $this->system->loadModel('content/article');
			$sitemap = $this->system->loadModel('content/sitemap');
			$this->pagedata['article'] = $oArticle->get($nConId);
			//$this->pagedata['path'] = $sitemap->getPathById($this->pagedata['article']['node_id'],false);
			$this->pagedata['node_id'] = $this->pagedata['article']['node_id'];
			$this->pagedata['article_cat'] = $oArticle->getArticleCat();

			$this->pagedata['article_id'] = $nConId;
			$this->setView('content/article/article.html');
			$this->output();
		}

		function save($article_id,$node_id)
		{
			if($_POST['ifpub']) $_POST['ifpub'] = 1;
			else $_POST['ifpub'] = 0;
			$this->begin('index.php?ctl=content/articles&act=detail&p[0]='.$article_id);
			$oArticle = $this->system->loadModel('content/article');
			$this->end($oArticle->saveArticle($_POST),__('文章保存成功'));
		}
	}

?>